// core/init_redis.go
package core

import (
	"context"
	"github.com/redis/go-redis/v9"
	"github.com/sirupsen/logrus"
	"muziai-server/global"
)

func InitRedisServer() *redis.Client {
	o := global.Config.Redis
	client := redis.NewClient(&redis.Options{
		Addr:     o.Addr,
		Password: o.Password,
		DB:       o.DB,
	})
	err := client.Ping(context.Background()).Err()
	if err != nil {
		logrus.Fatal(err)
	}

	InitRedisDelayQueue(client)
	return client
}
